[#import "/framework/JGP.htm"  as JGP]
<!--
项目   glSystem
作者   fdp
时间   2018/8/8
-->
[@JGP.head "Title"/]
[@JGP.body]
<!--内容-->
[/@JGP.body]

<jgp-div _row="['*','100']" _runit="px" _aux="true">
    <jgp-form slot="1-1" _id="addInform" _method="POST" _action="/glMeeting/informApiController/addInform">
        <jgp-text _col="12" _label="通知标题:" _name="informTitle" _id="informTitle" ></jgp-text>
        <jgp-drop _not_input="true" _label="关联会议:" _name="meetingID" _id="meetingID"
                  _url="/glMeeting/templateApiController/queryAllmeeting">
        </jgp-drop>
        <jgp-drop  _onchange="change" _id="chooseMb" _not_input="true" _label="选择模板:"
                  _url="/glMeeting/templateApiController/queryAllTem">
        </jgp-drop>
        <jgp-btn _fn="showAllUsers">选择要通知的人员</jgp-btn>
        <jgp-area  _col="12" _label="模板内容:" _id="area" _name="informContent" _row="10"></jgp-area>
    </jgp-form>
    <jgp-div slot="2-1" _col="['*','*']" _aux="true">
        <jgp-btn slot="1-1" _fn="reset">重置</jgp-btn>
        <jgp-btn slot="1-2" _fn="saveInform">保存</jgp-btn>
    </jgp-div>

</jgp-div>

[@JGP.foot]

<script>




    //模板变化事件
    function change() {

        var str = JGP.drop("chooseMb").val()

     // if(str == '1'){
     //        JGP.area('area').setReadOnly(true);
     //
     //    }


      //  alert(str)
        JGP.$post('/glMeeting/templateApiController/changeA',{str:str}, function (res) {
           // console.log(res.data.content);
             // JGP.drop('chooseMb').val(res.data.content);
          JGP.area("area").val(res.data.content);

        })
    }




    var arrayID;
    //弹出页显示全部人员进行手动添加
    function showAllUsers(re) {

        var config = {
            url: '/glMeeting/templateController/showAllUsers',
            title: "选择通知人员",
            callback: function (res) {
               // console.log(res)
                arrayID=res;
                // alert(arrayID)
               if (res == true) {

                    window.location.reload();
                }
            },
            width: '600px',
            height: '500px'
        }
        JGP.$dialog(config)
    }


    //重置
    function reset() {
        JGP.form('addInform').reset();
    }

/*        function saveInform() {
            var addInform = JGP.form("addInform");
            addInform.ajaxSubmit(function success(res) {
                if (res.flag == true) {
                    JGP.$alert("添加成功");
                    // JGP.form("addInform").reset();
                    JGP.$close(res.flag);
                }
            })
        }
        }*/

       function saveInform(res) {
           var informTitle=JGP.text("informTitle").val();

           var meetingID=JGP.drop("meetingID").val();
            var informContent=JGP.area("area").val();
         var usersIDs=arrayID;
        // console.log(informTitle)
          // console.log(informContent)
         //  console.log(usersIDs);
           usersIDs=usersIDs+"";
           JGP.$post("/glMeeting/informApiController/addInform",{usersIDs:usersIDs,informContent:informContent,informTitle:informTitle,meetingID:meetingID},function (res) {
               JGP.$alert("添加成功");
               JGP.$close(res.flag);
           })
       }




</script>
[/@JGP.foot]